package com.xmy.cultivate.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xmy.cultivate.entity.EnrollInviteDetail;
import com.xmy.cultivate.entity.RecordCourse;
import com.xmy.cultivate.entity.views.ResTryListenRecord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 邀约详情 Mapper 接口
 * </p>
 *
 * @author hpiggy
 * @since 2024-08-22
 */
public interface EnrollInviteDetailMapper extends BaseMapper<EnrollInviteDetail> {

    @Select("select t1.*,t2.phone from enroll_invite_detail as t1 INNER JOIN enroll_customer as t2 on t1.customer_id = t2.id WHERE t1.invite_time BETWEEN #{startDateTime} and #{endDateTime}")
    public List<EnrollInviteDetail> getEnrollInviteDetailList(@Param("startDateTime") String startDateTime, @Param("endDateTime") String endDateTime);

    @Select({"<script>",
            "SELECT",
                    "t1.*,",
                    "t2.linkman_phone ",
                    "FROM",
                    "record_course AS t1",
                    "INNER JOIN student AS t2 ON t1.student_id = t2.id ",
                    "WHERE",
                    "t1.deleted = 0 ",
                    "AND t1.course_type = 8 ",
                    "AND t1.lesson_type = 1 ",
                    "AND t1.year_part = ${yearPart} ",
                    "AND t1.`quarter` = ${quarterNum} ",
                    "AND t1.school_date = #{schoolDate}",
                    "AND t2.linkman_phone = #{phone}",
    "</script>"})
    public List<ResTryListenRecord> getTryListenList(@Param("yearPart") Integer yearPart, @Param("quarterNum") Integer quarterNum, @Param("schoolDate") String schoolDate,@Param("phone") String phone);

}
